package hsp.admin.app.literature.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import hsp.admin.app.literature.aop.UpCountDelete;
import hsp.admin.app.literature.enums.LiteratureType;
import hsp.admin.app.literature.mapper.ArticleMapper;
import hsp.admin.app.literature.po.ArticlePO;
import hsp.admin.app.literature.service.IArticleService;
import hsp.admin.app.literature.vo.ArticleVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, ArticlePO> implements IArticleService {

    private final ArticleMapper mapper;

    @Autowired
    public ArticleServiceImpl(
        ArticleMapper mapper
    ){
        this.mapper = mapper;
    }

    @Override
    public Page<ArticleVO> pageVO(Page<ArticleVO> page, ArticlePO po) {
        return mapper.selectPageVO(page, po);
    }

    @Override
    @UpCountDelete(LiteratureType.Article)
    public boolean removeById(Serializable id) {
        return super.removeById(id);
    }

}
